<?php

namespace app\common\exception;

use app\common\traits\InstanceTrait;

class ExceptionEmun extends BaseException
{
    use InstanceTrait;
}

class SystemException
{
    const INVALID_USE_REDIS = ['msg' => '错误使用缓存', 'code' => 10001,];
    const INVALID_OPERATE = ['msg' => '非法操作', 'code' => 10002,];
    const INVALID_PARAMETER = ['msg' => '非法参数', 'code' => 10003,];
    const EMPTY_CONFIG = ['msg' => '加载配置项失败', 'code' => 10004,];
    const CROS_CONFIG = ['msg' => 'CROS成功', 'code' => 10005,];
    const INVALID_ROUTE = ['msg' => '路由地址不正确', 'code' => 10006,];
    const CREATE_FAILE = ['msg' => '添加失败', 'code' => 10007,];
    const UPDATE_FAILE = ['msg' => '编辑失败', 'code' => 10008,];
    const SPECIAL_ERROR = ['msg' => '对不起,有一个特殊错误出现,请联系运营', 'code' => 10009,];
    const NO_CAPTCHA = ['msg' => '请输入验证码', 'code' => 10010,];
    const CAPTCHA_ERROR = ['msg' => '验证码错误', 'code' => 10011,];
    const FIELD_CONFILICT = ['msg' => '字段冲突', 'code' => 10012,];
    const EMPTY_CONFIG_APP_NAME = ['msg' => '.env项目名称未设置', 'code' => 10013,];
    const RELOGIN = ['msg' => '请重新登录', 'code' => 10014,];
    const EMPTY_VALIDATE = ['msg' => 'Validate未完善', 'code' => 10015,];
}

class FileException
{
    const FILE_ERROR = ['msg' => '上传文件失败', 'code' => 10100,];
    const FILE_SIZE = ['msg' => '上传文件尺寸过大', 'code' => 10101,];
    const FILE_SUFFIX = ['msg' => '上传文件格式不正确', 'code' => 10102,];

}

class TokenException
{
    const ILLEGAL_TOKEN = ['msg' => '非法TOKEN,请重新获取', 'code' => 10201,];
    const EXPIRED_TOKEN = ['msg' => '过期TOKEN,请重新获取', 'code' => 10202,];
    const ERROR_WX_API = ['msg' => '获取SESSION_KEY及OPENID时异常，微信内部错误', 'code' => 10203,];
}

/**
 * 公共用户异常
 * Class UserException
 * @package app\common\exception
 */
class UserException
{
    const NO_EXIST = ['msg' => '账号不存在', 'code' => 20000,];
    const INCORRECT_PASSWORD = ['msg' => '密码错误', 'code' => 20001,];
    const FREQUENT_REGISTER = ['msg' => '注册过于频繁,请稍后再试', 'code' => 20002,];
    const NO_RIGHT = ['msg' => '帐号没有权限', 'code' => 20003,];
    const LOCKED = ['msg' => '帐号已被禁用', 'code' => 20004,];
    const NO_GROUP = ['msg' => '至少勾选一个用户组', 'code' => 20005,];
    const UPDATE_ADMIN = ['msg' => '不能操作超级管理员', 'code' => 20006,];
    const NAME_REPEAT = ['msg' => '用户名重复', 'code' => 20007,];
    const PASSWORD_REPEAT = ['msg' => '新旧密码不能相同', 'code' => 20008,];
}

class PlanException
{
}

class StructureException
{
    const NO_EXIST = ['msg' => '部门不存在', 'code' => 30100,];
    const NO_RIGHT = ['msg' => '无权操作部门', 'code' => 30101,];
    const PID_NO_EXIST = ['msg' => '父部门不存在', 'code' => 30102,];
    const PID_NO_RIGHT = ['msg' => '父部门不正确', 'code' => 30103,];
    const NAME_REPEAT = ['msg' => '部门名重复', 'code' => 30104,];
}

class PostException
{
    const NO_EXIST = ['msg' => '岗位不存在', 'code' => 30200,];
    const NO_RIGHT = ['msg' => '无权操作岗位', 'code' => 30201,];
    const PID_NO_EXIST = ['msg' => '父岗位不存在', 'code' => 30202,];
    const PID_NO_RIGHT = ['msg' => '父岗位不正确', 'code' => 30203,];
    const NAME_REPEAT = ['msg' => '岗位名重复', 'code' => 30204,];
    const STRUCTURE_EMPTY = ['msg' => '部门不存在', 'code' => 30205,];
}

class CategoryException
{
    const NO_EXIST = ['msg' => '分类不存在', 'code' => 30300,];
    const NO_RIGHT = ['msg' => '无权操作文章分类', 'code' => 30301,];
    const NAME_REPEAT = ['msg' => '文章分类名重复', 'code' => 30304,];
}

class ArticleException
{
    const NO_EXIST = ['msg' => '文章不存在', 'code' => 30400,];
    const NO_RIGHT = ['msg' => '无权操作文章', 'code' => 30401,];
    const NAME_REPEAT = ['msg' => '文章名重复', 'code' => 30404,];
    const CATEGORY_EMPTY = ['msg' => '文章分类不存在', 'code' => 30405,];
}

class RuleException
{
    const NO_EXIST = ['msg' => '权限不存在', 'code' => 30500,];
    const PID_NO_EXIST = ['msg' => '父权限不存在', 'code' => 30501,];
    const PID_NO_RIGHT = ['msg' => '父权限不正确', 'code' => 30502,];
    const NAME_REPEAT = ['msg' => '用户组名重复', 'code' => 30503,];
}

class MenuException
{
    const NO_EXIST = ['msg' => '菜单不存在', 'code' => 30000,];
    const NO_RIGHT = ['msg' => '不能操作他人菜单', 'code' => 30001,];
    const PID_NO_EXIST = ['msg' => '父菜单不存在', 'code' => 30102,];
    const PID_NO_RIGHT = ['msg' => '父菜单不正确', 'code' => 30103,];
    const NAME_REPEAT = ['msg' => '菜单名重复', 'code' => 30104,];
}

class GroupException
{
    const NO_EXIST = ['msg' => '用户组不存在', 'code' => 30600,];
    const NAME_REPEAT = ['msg' => '用户组名重复', 'code' => 30601,];
}



